/**
 * Created by leon on 2017/5/9.
 */
(function () {
    'use strict';
    angular.module('App.pages.member')
        .controller('MineMenuCtrl',MineMenuCtrl);
    function MineMenuCtrl($scope,MemberModel,AppUtils,$state,LoginAccountAuth) {
        var vm = this;
        vm.items = [];
        vm.pageIndex = 1;
        vm.loadMoreBtnStatus = true;
        vm.loadMoreBtnStr = "加载更多";
        vm.loginAccount = {};
        vm.teacherInfo = {};
        LoginAccountAuth.getAccount().then(function(data){
            vm.loginAccount = data;
            MemberModel.getMemberInfo({id:data.memberId}).$promise.then(function(response){
                if(!AppUtils.isUndefinedOrNull(response.memberInfo)){
                    vm.memberInfo = response.memberInfo;
                }else {
                    AppUtils.showTipsTop("未查询到您的信息！");
                }
            })

            MemberModel.getStudentInfoByParentId({memberId:data.memberId}).$promise.then(function (response){
                if(!AppUtils.isUndefinedOrNull(response.studentInfo)){
                    vm.studentInfo = response.studentInfo;
                }else {
                    AppUtils.showTipsTop("未查询到您孩子的信息！");
                }
            })
        })
        $scope.editMemberInfo = function(){
            $state.go("memberMenu.edit");
        }

    }
})();